package com.xian.tszs.meal.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xian.tszs.meal.entity.Gscoupon;
import com.xian.tszs.meal.mapper.GsCouponMapper;
import com.xian.tszs.meal.repository.GsCouponRepository;
import com.xian.tszs.meal.service.GsCouponService;
import com.xian.tszs.meal.utils.UUIDUtils;

@Service
public class GsCouponServiceImpl implements GsCouponService {
	
	@Autowired
	private GsCouponRepository gsCouponRep;
	
	@Autowired
	private GsCouponMapper gsCouponMapper;
	
	@Override
	public List<Gscoupon> findCouponPage(Gscoupon coupon) {
		return gsCouponMapper.findCouponPage(coupon);
	}

	@Override
	public void saveCoupon(Gscoupon coupon) {
		coupon.setId(UUIDUtils.getUUID());
		coupon.setCreateTime(new Date());
		gsCouponRep.save(coupon);
		
	}

	@Override
	public void deleteCouponById(String id) {
		
		gsCouponRep.deleteById(id);
		
	}

	@Override
	public Gscoupon findCouponById(String id) {
		return gsCouponMapper.findById(id);
	}

	@Override
	public void updateGsCoupon(Gscoupon coupon) {
		
		gsCouponMapper.updateGsCoupon(coupon);
		
	}

	@Override
	public void deleteMany(String[] ids) {
		gsCouponMapper.deleteMany(ids);
	}

}
